package xalan.xml;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public abstract class SerializationTemplate {
	public void serializeToXml(String fileName) {
		Document document;
		try {
			document = XMLUtils.newDocument();
			Element e = buildRootElement(document);
			document.appendChild(e);
			XMLUtils.writeDocumentToFile(document, fileName);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}	
	}

	protected abstract Element buildRootElement(Document document);
}
